<template>
	<view class="content">
		<u-navbar :title="title" :border-bottom="false" back-icon-color="#ffffff" title-color="#fff" :background="{backgroundColor:'#2A2931'}"></u-navbar>
		<view v-for="(item, index) in ffList" :key="item.addtime" class="item" :data-title="item.title">
			<block v-if="id==1">
				<image mode="aspectFill" :src="item.head | formatImage" />
				<!-- 此层wrap在此为必写的，否则可能会出现标题定位错误 -->
				<view class="content-wrap">
					<view class="contents">{{item.desc}}</view>
					<view class="top">
						<view class="time">{{item.addtime}}</view>
						<view class="nickname" @click="openDy(index)">去看看<u-icon name="arrow-right"></u-icon></view>
					</view>
				</view>
			</block>
			<block v-if="id==4">
                <view class="left tx img-h">
                    <image src="/static/touxiang.png"></image>
                </view>
                <view class="rt">
                    <view style="color: #fff;">
                        <text style="color:#1fb4f6">匿名用户</text>给你的评论是<text v-for="content in item.content" style="color:#A87B38;margin-right: 10px;">{{ content }}分, </text>
                    </view>
                    <view style="display: flex;justify-content: space-between;color:#ccc;">
                        <text> </text>
                        <text>{{ item.addtime }}</text>
                    </view>
                </view>
			</block>
			<block v-if="id==5">
                <view class="tx img-h">
                    <image src="/static/ic_mianju.png"></image>
                </view>
                <view class="contents">
                    <view class="name-wrap" style="color: #fff;word-break: break-word;">
						<u-parse :html="item.content"></u-parse>
                    </view>
                    <view class="flex-bt footer" style="color: #ccc;font-size:24rpx;margin-top: 10rpx;">
                        <text class="time">{{ item.addtime }}</text>
                    </view>
                </view>
			</block>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '',
				ffList: [],
				id:'',
			}
		},
		onLoad(option) {
			this.title = option.title
			this.id = option.id
			this.getData()
			console.log(this.id )
			console.log("id")
		},
		methods: {
            openDy: function (index) {
                var data = this.ffList[index];
                if (data.leixing == 3) {
                } else {
					uni.navigateTo({
						url:'/pages/dydetail/index?id=' + data.dy_id
					})
                }
            },
			async getData(){
				var url
				if(this.id == 1){
					url = 'apis/home/User/sysDymanic'
				}else if(this.id == 4){
					url = 'apis/home/User/evalist'
				}else if(this.id == 5){
					url = 'apis/home/User/tongzhi'
				}
				const {data:res} = await this.$Request({
					url: url,
					data: {user_id: this.$store.state.userid}
				})
				
				if(res && res.data){
					this.ffList = res.data;
					console.log(res.data)
					console.log("系统消息数据")
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		background-color: #2A2931;
		
		min-height: 100vh;
		
		min-height: calc(100vh - 44px);
		
			.item {
				display: flex;
				padding: 20rpx;
				.head{
					position: relative;
				}
				image {
					width: 110rpx;
					flex: 0 0 110rpx;
					height: 110rpx;
					margin-right: 20rpx;
					border-radius: 110rpx;
					
				}
				
				.content-wrap {
					width: calc(100vw - 172rpx);
					.top{
						margin-top:10rpx;
						width: 100%;
						display: flex;
						justify-content: space-between;
						color: #aaa;
						.time{
							flex: 1;
						}
					}
					.contents{
						color: #fff;
						margin:10rpx 0;
					}
				}
			}
	}
</style>
